#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main()
{
	string a;
	while (cin >> a) {
		if (a == "#") {
			break;
		}
		string b;
		cin >> b;
		int ans = 0;
		while (a.find(b) != -1) {
			ans++;
			a.erase(a.begin(), a.begin() + (a.find(b) + b.size()));
		}
		cout << ans << endl;
	}
	return 0;
}